#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
  long long largestPerimeter(vector<int> &nums)
  {
    long long ans = -1, tmp = 0;
    sort(nums.begin(), nums.end());
    for (int x : nums)
    {
      tmp += x;
      if (tmp - x > x)
        ans = tmp;
    }
    return ans;
  }
};
int main()
{
  Solution s;

  return 0;
}
